package com.imooc.proxy;

/**
 * 通过聚合的方式实现对Car的代理。
 * @author Administrator
 *
 */
public class CarTimeProxy implements Moveable {

	
	public CarTimeProxy(Moveable moveable) {
		super();
		this.moveable = moveable;
	}
	private Moveable moveable;

	@Override
	public void move() {
		long startTime = System.currentTimeMillis();
		System.out.println("汽车开始行驶");
		moveable.move();
		long endTime = System.currentTimeMillis();
		System.out.println("汽车结束行驶，行驶时间为："+(endTime-startTime)+"毫秒");
	}

}
